package cn.hpu.atm;

import java.util.Scanner;

public class HPUATM {
	Scanner sc = new Scanner(System.in);
	private String name = "安孝会";

	private double password = 123456;

	private double money = 500;

	public void aloha() {
		System.out.println("***********************");
		System.out.println("* *");
		System.out.println("* yang*");
		System.out.println("* *");
		System.out.println("*yang*");
		System.out.println("* *");
		System.out.println("* *");
		System.out.println("************************");
		System.out.println("Abel");
		String s = sc.next();
		if (s.equals("Abel")) {
			System.out.println("Abel");
			int n = 0;
			int ss = sc.nextInt();
			while (ss != 123456) {
				System.out.println("Abel");
				ss = sc.nextInt();
				n++;
				if (n == 2)
					break;
			}
			if (ss == 123456) {
				land();
			} else {
				System.out.println("ÃÜÂë´íÎó£¬ÏµÍ³ÍË³ö");
				System.exit(0);
			}

		} else {
			System.out.println("ÓÃ»§Ãû´íÎó£¬ÏµÍ³ÍË³ö");
			System.exit(0);
		}

	}

	// µÇÂ½Ò³Ãæ
	public void land() {

		System.out.println("ÇëÑ¡Ôñ²Ù×÷½çÃæ£º1È¡¿î£¬2´æ¿î£¬3²éÑ¯£¬4×ªÕË£¬5ÍË³ö");
		int a = sc.nextInt();
		switch (a) {
		case 1:
			draw();
			break;
		case 2:
			deposit();
			break;
		case 3:
			query();
			break;
		case 4:
			divert();
			break;
		case 5:
			Out();
			break;
		}
	}

	// È¡¿î
	public void draw() {
		System.out.println("ÇëÊäÈëÈ¡¿î½ð¶î£º");
		int a = sc.nextInt();
		if (a > money) {
			System.out.println("Óà¶î²»×ã£¡");
		} else {
			money -= a;
			land();
		}

	}

	// ´æ¿î
	public void deposit() {
		System.out.println("ÇëÊäÈë´æ¿î½ð¶î£º");
		int a = sc.nextInt();
		money += a;
		land();

	}

	// ²éÑ¯
	public void query() {
		System.out.println("µ±Ç°Óà¶îÎª£º" + money);
		land();

	}

	// ×ªÕË
	public void divert() {
		System.out.println("¸Ã¹¦ÄÜÕ¾Î´¿ª·Å£¡");
		land();
	}

	// ÍË³ö
	public void Out() {
		System.exit(0);
	}

	public static void main(String[] args) {
		HPUATM atm = new HPUATM();
		atm.aloha();

	}

}
